﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterCustomerLogin.master" AutoEventWireup="true" CodeBehind="Order.aspx.cs" Inherits="UdrinkWater_Project.Customer.Order" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%" 
        HeaderText="สินค้า">
        <HeaderStyle Font-Size="Large" />
        <PanelCollection>
            <dx:PanelContent runat="server" SupportsDisabledAttribute="True">
                <dx:ASPxDataView ID="DataViewGoods" runat="server" Height="100%" 
                    PagerAlign="Justify" Width="100%" DataSourceID="SqlShowData" 
                    OnItemCommand="DataViewGoods_ItemCommand">
                    <ItemTemplate>
             <table style="margin: 0 auto;">
                <tr>
                    <td colspan="2" align="center" style="text-align: center">
                        <dx:ASPxImage ID="imgCover" runat="server" ImageUrl='<%# Eval("Image_Path") %>' Width="150px" Height="150px" ShowLoadingImage="true" /> 
                    </td>
                </tr>
                 <tr>
                    <td style="text-align: right"><b>รหัสสินค้า:</b></td>
                    <td><dx:ASPxLabel ID="lblName" runat="server"  Text='<%# Eval("Product_ID") %>' /></td>
                </tr>
                 <tr>
                    <td style="text-align: right"><b>ชื่อสินค้า:</b></td>
                    <td><dx:ASPxLabel ID="lblAddress" runat="server" Text='<%# Eval("Product_name") %>' /></td>
                </tr>
                 <tr>
                    <td style="text-align: right"><b>ราคาขาย:</b></td>
                    <td><dx:ASPxLabel ID="lblPrice" runat="server" Text='<%# Eval("Price") %>' /></td>
                </tr>
                 <tr>
                    <td style="text-align: right"><b>หน่วยการขาย:</b></td>
                    <td><dx:ASPxLabel ID="lb_Unit" runat="server" Text='<%# Eval("Unit_Name") %>' /></td>
                </tr>
                 <tr>
                    <td style="text-align: right"><b>จำนวน:</b></td>
                    <td>
                        <table style="width: 100%">
                            <tr>
                                <td>
                                    <dx:ASPxTextBox ID="Tb_Price" runat="server" Width="50px" MaxLength="6" >
                                     <%--   <ClientSideEvents KeyDown="function(s, e) {
	if (!((e.htmlEvent.keyCode &gt;= 48 &amp;&amp; e.htmlEvent.keyCode &lt;= 57) || 
           (e.htmlEvent.keyCode == 8 || e.htmlEvent.keyCode == 46 || e.htmlEvent.keyCode == 37 || 
            e.htmlEvent.keyCode == 39))) 
        ASPxClientUtils.PreventEventAndBubble(e.htmlEvent);   
}" />--%>
                                        <ValidationSettings ErrorDisplayMode="None">
                                        </ValidationSettings>
                                    </dx:ASPxTextBox>
                                </td>
                                <td>
                                  
                            </tr>
                        </table>
                     </td>
                </tr>
            </table>
        </ItemTemplate>
                </dx:ASPxDataView>
                <asp:SqlDataSource ID="SqlShowData" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
                    
                    
                    SelectCommand="SELECT TB_Product.Product_ID, TB_Product.Product_name, TB_Product.Price, TB_Product.In_Stock, TB_Product.Image_Path, TB_Unit_Category.Unit_Name FROM TB_Product LEFT OUTER JOIN TB_Unit_Category ON TB_Product.Unit = TB_Unit_Category.Unit_ID"></asp:SqlDataSource>
                <asp:Panel ID="Panel1" runat="server">
                    <table style="width: 100%">
                        <tr>
                            <td align="right" width="45%" style="height: 27px">
                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                                    SelectCommand="SELECT FROM TB_Orderlist INNER JOIN TB_Product ON TB_Orderlist.Product_ID = TB_Product.Product_ID">
                                </asp:SqlDataSource>
                                <dx:ASPxButton ID="btOrderSubmit" runat="server" OnClick="ASPxButton1_Click" 
                                    Text="สั่งซื้อ" Width="150px">
                                    <ClientSideEvents Click="function(s, e) {
	 e.processOnServer = confirm('ยืนยันการสั่งซื้อ?');
}" />
                                </dx:ASPxButton>
                            </td>
                            <td width="10%" style="height: 27px">
                                </td>
                            <td width="45%" style="height: 27px">
                                <dx:ASPxButton ID="btCancleOrder" runat="server" OnClick="btCancleOrder_Click" 
                                    Text="ยกเลิก" Width="150px" Height="23px">
                                    <ClientSideEvents Click="function(s, e) {
	e.processOnServer = confirm('ยกเลิกการสั่งซื้อ?');
}" />
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
